Repository navigation
Conversation
The library no longer settles an entry 'expired'. It ignores the descriptor's expiresAt and configure()'s lifetimeMs. Removed: the expiry checks before an attempt, at each network poll and in each chunked part; the cap of in-worker backoffs, long releases and timeout releases at expiresAt; and the expiry wake of a parked entry at park, in the boot sweep and in the repair. A parked entry now gets no WorkManager row, and the sweep cancels a wake an earlier version left for it. New entries store expiresAt = Long.MAX_VALUE, so 11.3.0, which reads the field as a deadline, does not expire them after a downgrade. Entries from earlier versions keep their value and are sent. A stored 'expired' outcome is still delivered. The boot snapshot keeps delayedPastHorizon, now with its own 24-hour constant. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…the contract PR A same-body mutate() now writes expiresAt = Long.MAX_VALUE too, so an entry from 11.3.0 that is queued again here does not expire after a downgrade. The comment names the versions this is checked for: 11.0.2 to 11.3.0. README.md and the doc comments in src/ go back to the base branch. The contract PR rewrites the same sentences, and its text is the end state. The CHANGELOG entry now speaks of the native module only. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This must ship in the same release as #92 and the iOS removal.
The README and the type docs change in #92, "Contract: a request has no deadline;
expiresAtandlifetimeMsare deprecated and ignored" (#92). This PR leaves them as they are, so the two do not conflict.What was wrong
Android ran a timer on every request. When a request's
expiresAtpassed, the library settled iterrorwitherrorKind: 'expired', also when the server was only down for a while. That is acancel()the library made on its own, and it works against the main goal: every request started on the device reaches the server.The one app that uses the library does not need it: it sets a 10-year lifetime and queues again what expires.
The timer also caused defects. A parked (
awaiting-auth) entry got a WorkManager wake at itsexpiresAtwhen that was less than 24 hours away. Each wake holds one of the app's 20 JobScheduler slots until it runs, so many parked entries could keep other uploads from starting.What changes
expiresAt.updateHeaders()or a same-idmutate(). The boot sweep cancels a wake that an earlier version left for it.expiresAt, andconfigure()with or withoutlifetimeMs, and ignores both.entry.jsonkeeps theexpiresAtfield. 11.0.2 to 11.3.0 read it as the deadline, and read a missing one as 0, which is already past. So a new entry, and an entry queued again by a same-idmutate(), storesLong.MAX_VALUE. An app that goes back to one of those versions does not expire it, and those versions do no sum with the field that overflows. An entry from an earlier version that is not queued again keeps its value. Nothing reads it.delayedPastHorizonwith the same 24-hour line, now a constant of its own. The app reads it as a sign of a stuck queue.android/src/main: 53 lines added, 94 removed.Behavior change
expired. A request retries until the server accepts it, a response or a missing file settles it as an error, or the app callscancel(id).maxMsto 30 s or less. Both existed before with a far deadline: a 10-year lifetime never ended them.cancel(id)itself.expiresAthas passed.expiredoutcome that an earlier version stored and the app has not acknowledged is still delivered, unchanged.What it does not change
expiresAtand validateslifetimeMs. Contract: a request has no deadline;expiresAtandlifetimeMsare deprecated and ignored #92 changes all three.maxRetries, a missing file, an unknown error, andcancel().Tests
Tests that asserted expiry are rewritten to assert the new rule. The new and rewritten tests:
expiresAtin the past is sent, simple and chunked.expiresAtkeeps polling, then sends.expiresAtretries on the normal backoff, in the worker (1 s, then 2 s) and on a long release (the full 60 s).expiresAtreleases to the full next backoff step.expiresAtis sent at resume.updateHeaders()then sends it.expiresAt12 hours away leave 1 unfinished WorkManager row in all: the network doorbell. The test counts the rows after a second boot sweep, which runs once everyexpiresAthas passed.expiresAtin the past loads after a relaunch and is scheduled."expiresAt":9223372036854775807, and it reads back exact. A same-body re-queue of an entry whoseexpiresAtis 5 stores the same value.expiredoutcome from an earlier version is delivered unchanged.expiresAtmissing, 0, negative, in the past, a string, or null.Mutation checks. Each one puts an expiry behaviour back in a scratch copy and runs the full suite. Every one makes a test fail:
expiredbefore an attemptexpiredexpiresAtexpiresAtexpiresAtexpiresAtexpiredexpiresAtexpiresAtexpiresAtexpiredoutcomeLocal checks on the tip commit, by exit code:
./gradlew --no-daemon :react-native-background-upload:testDebugUnitTest: exit 0, 607 tests, 0 failures (600 on the base branch).yarn test: exit 0, 305 tests.yarn typecheck: exit 0.yarn lint:ci: exit 0.Review
An independent review agent read all 26 files, put each removed behaviour back in a scratch copy (each one made a test fail), and checked every use of the stored field in 11.0.2 to 11.3.0 for the downgrade case. Verdict: no blocker. Its four low items are fixed in the last commit.
🤖 Generated with Claude Code